// Mesh3D.h
//
//////////////////////////////////////////////////////////////////////

#ifndef __MESH3D_H_
#define __MESH3D_H_

#include "Geometry.h"
#include "Container.h"


/** Mantiene informaci� de v�tices, aristas y caras de una malla poligonal.
Y proporciona m�odos para acceder a estas de manera sencilla. */


class DLL_API Mesh3D:public Geometry{
public:
	Mesh3D();
	Mesh3D(Geometry &);

	virtual ~Mesh3D();

	virtual void clear();
	void calculateNormals(void);
	virtual LIB3D_RETURN setTexture(Texture3D * tex);
	virtual Texture3D * getTexture();
	
	//M�odos para acceder a los v�tices y las caras.

	virtual LIB3D_RETURN startFaceIteration();
	virtual Triangle & getNextFace();
	virtual int finishedFaceIteration();
	virtual Triangle & getFace(unsigned index);
	virtual Triangle & operator[](unsigned index);
	virtual Vertex3D & getVertex(unsigned index);
	virtual LIB3D_RETURN addFace(Triangle face);
	virtual LIB3D_RETURN addVertex(Vertex3D v);
	virtual LIB3D_RETURN removeFace(unsigned index);
	virtual LIB3D_RETURN removeVertex(unsigned index);
	virtual LIB3D_RETURN setVertex(unsigned index, Vertex3D v);
	virtual LIB3D_RETURN setFace(unsigned index, Triangle face);
	virtual unsigned getVertexCount();
	virtual unsigned getFaceCount();

//M�odos para representar
	virtual bool allowsFastAccess();
	virtual Vertex3D * getVertexPointer();
	virtual unsigned * getFacePointer();
	virtual INTERNAL_REP getInternalRepresentation();

protected:
	int iterator;
	VERTEX_CONTAINER  vertex;
	TRIANGLE_CONTAINER faces;
	Texture3D * texture;
};
#endif

